package app.fugema.shop.main.home.vm;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import app.fugema.shop.http.HttpService;
import app.fugema.shop.main.goods.vm.GoodsVM;
import app.fugema.shop.main.login.model.CheckImgResult;
import app.fugema.shop.main.login.model.MUserInfo;

import com.base.common.netBeanPackage.BaseApiResult;
import com.base.common.netBeanPackage.LiveDataWrapper;
import com.base.common.viewmodel.BaseViewModel;

public class MyCenterVM extends BaseViewModel {

    private GoodsVM goodsVM;

    public MyCenterVM(@NonNull Application application) {
        super(application);
        goodsVM = new GoodsVM(application);
        addBaseViewModel(goodsVM);
    }


    public GoodsVM getGoodsVM() {
        return goodsVM;
    }

    /**
     *  刷新用户 数据
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<MUserInfo>> refreshUserInfo(String userKey)
    {
        return send(HttpService.getHttpServer().userInfo(userKey));
    }

    /**
     *  添加 deviceToken
     * @param userId
     * @param deviceToken
     * @return
     */
    public MutableLiveData<LiveDataWrapper<BaseApiResult>> setUesrDeviceToken(int userId,String deviceToken)
    {
        return send(HttpService.getHttpServer().uMengAddDeviceToken(userId,deviceToken));
    }
}
